package com.lqm.entity.home;

import com.fasterxml.jackson.annotation.JsonManagedReference;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * @program: CrowdFunding
 * @description
 * @author: lqm
 * @create: 2018-12-14 14:12
 */

@Entity
@Table(name = "project_support", schema = "crowdfunding", catalog = "")
public class ProjectSupport  implements Serializable {
    private Integer supportId;
    private Integer num;
    private BigDecimal price;
    private String username;
    private String address;
    private String phone;
    private Integer status=1;
    private Integer projectStatus=0;



    private HomeUser homeUser;
    private Project project;

    @Id
    @Column(name = "support_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getSupportId() {
        return supportId;
    }

    public void setSupportId(Integer supportId) {
        this.supportId = supportId;
    }

    @Basic
    @Column(name = "num", nullable = true)
    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    @Basic
    @Column(name = "price", nullable = true, precision = 2)
    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    @Basic
    @Column(name = "username", nullable = true, length = 50)
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Basic
    @Column(name = "address", nullable = true, length = 255)
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Basic
    @Column(name = "phone", nullable = true, length = 255)
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Basic
    @Column(name = "status", nullable = false, length = 3)
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }


    @Basic
    @Column(name = "projectStatus", nullable = false, length = 3)
    public Integer getProjectStatus() {
        return projectStatus;
    }

    public void setProjectStatus(Integer projectStatus) {
        this.projectStatus = projectStatus;
    }




    @ManyToOne
    @JoinColumn(name = "support_user_id", referencedColumnName = "id")
    public HomeUser getHomeUser() {
        return homeUser;
    }

    public void setHomeUser(HomeUser homeUser) {
        this.homeUser = homeUser;
    }



    @ManyToOne
    @JoinColumn(name = "support_project_id", referencedColumnName = "project_id")
    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    @Override
    public String toString() {
        return "ProjectSupport{" +
                "supportId=" + supportId +
                ", num=" + num +
                ", price=" + price +
                ", username='" + username + '\'' +
                ", address='" + address + '\'' +
                ", phone='" + phone + '\'' +
                ", status=" + status +
                ", projectStatus=" + projectStatus +
                ", homeUser=" + homeUser +
                ", project=" + project +
                '}';
    }
}
